package iut.acy.cut4u.model;

import iut.acy.cut4u.model.RendezVous;
import iut.acy.cut4u.model.Sexe;
import junit.framework.TestCase;
import java.util.Calendar;
import java.util.GregorianCalendar;

public class RendezVousTest extends TestCase {

	private RendezVous rvHorsRepos;
	private RendezVous rvReposMatin;
	private RendezVous rvReposAprem;
	
	private RendezVous rvHorsConges;
	private RendezVous rvPdtConges;
	
	private RendezVous rvHorsCongesHorsRepos;
	private RendezVous rvHorsCongesPdtRepos;
	private RendezVous rvPdtCongesHorsRepos;
	private RendezVous rvPdtCongesPdtRepos;
	
	
	protected void setUp() throws Exception {
		super.setUp();
		
		Employe e = new Employe (Sexe.FEMININ,"Tet","Andreane",StatutEmploye.CDI,
				CategorieEmploye.COIFFEUR);
		e.ajouteConge(new Conge(new GregorianCalendar(2011,12-1,23), new GregorianCalendar(2011,12-1,28)));
		e.ajouteDemiJourRepos(1);
		e.ajouteDemiJourRepos(2);

		rvHorsRepos= new RendezVous(new GregorianCalendar(2011,12-1,1),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		rvReposMatin= new RendezVous(new GregorianCalendar(2011,12-1,26),new Horaire(9,0),new Horaire(10,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		rvReposAprem= new RendezVous(new GregorianCalendar(2011,12-1,26),new Horaire(14,0),new Horaire(15,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
	
		rvHorsConges= new RendezVous(new GregorianCalendar(2011,12-1,1),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		rvPdtConges= new RendezVous(new GregorianCalendar(2011,12-1,24),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		
		rvHorsCongesHorsRepos= new RendezVous(new GregorianCalendar(2011,12-1,1),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		rvHorsCongesPdtRepos= new RendezVous(new GregorianCalendar(2011,12-1,26),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		rvPdtCongesHorsRepos= new RendezVous(new GregorianCalendar(2011,12-1,24),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
		rvPdtCongesPdtRepos= new RendezVous(new GregorianCalendar(2011,12-1,26),new Horaire(8,0),new Horaire(9,0),e,new Client(Sexe.MASCULIN,"Bordier","Charles"));
	}
	
	protected void tearDown() throws Exception {
		super.tearDown();
	}

	
	public void testEstCompatibleReposEmploye ( ){
		
		try{
			assertTrue("Est compatible repos", rvHorsRepos.estCompatibleReposEmploye());
		
			assertFalse("Pendant repos matin", rvReposMatin.estCompatibleReposEmploye());
		
			assertFalse("Pendant repos aprem", rvReposAprem.estCompatibleReposEmploye());
		}
		catch(Exception e)
		{}
		
		
	}
	
	public void testEstCompatibleCongesEmploye ( ){
		
		try{
			assertTrue("Est compatible conges", rvHorsConges.estCompatibleCongesEmploye());
			
			assertFalse("N'est pas compatible conges", rvPdtConges.estCompatibleCongesEmploye());
		}
		catch(Exception e)
		{}		
	}
	
	public void testeEstCompatibleEmploye ( ){
		
		try{
			assertTrue("Est compatible employe", rvHorsCongesHorsRepos.estCompatibleEmploye());
			
			assertFalse("Bloque pour repos", rvHorsCongesPdtRepos.estCompatibleEmploye());
			
			assertFalse("Bloque pour conges", rvPdtCongesHorsRepos.estCompatibleEmploye());
			
			assertFalse("Bloque pour tout", rvPdtCongesPdtRepos.estCompatibleEmploye());
			
		}
		catch(Exception e)
		{}
	}
	
}
